package com.web.pojo.vo;

import com.web.utils.ToolUtil;

import javax.tools.Tool;
import java.io.Serializable;
import java.util.Arrays;

/**
 * @Author: wws
 * describe:
 */
public class GetSwitchOperatingHours implements Serializable {
    private Integer deviceId;
    private Integer channel1ElectrifyTime;//通道一通电时间
    private Integer channel2ElectrifyTime;//通道二通电时间
    private Integer operatingHours;//工作时间

    public GetSwitchOperatingHours() {
    }

    public GetSwitchOperatingHours(Integer deviceId, byte[] data) {
        this.deviceId = deviceId;
        this.channel1ElectrifyTime = ToolUtil.byteArrayToInt(Arrays.copyOfRange(data, 5, 9));
        this.channel2ElectrifyTime = ToolUtil.byteArrayToInt(Arrays.copyOfRange(data, 9, 13));
        this.operatingHours = ToolUtil.byteArrayToInt(Arrays.copyOfRange(data, 13, 17));
    }

    public GetSwitchOperatingHours(Integer deviceId, Integer channel1ElectrifyTime, Integer channel2ElectrifyTime, Integer operatingHours) {
        this.deviceId = deviceId;
        this.channel1ElectrifyTime = channel1ElectrifyTime;
        this.channel2ElectrifyTime = channel2ElectrifyTime;
        this.operatingHours = operatingHours;
    }

    public Integer getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(Integer deviceId) {
        this.deviceId = deviceId;
    }

    public Integer getChannel1ElectrifyTime() {
        return channel1ElectrifyTime;
    }

    public void setChannel1ElectrifyTime(Integer channel1ElectrifyTime) {
        this.channel1ElectrifyTime = channel1ElectrifyTime;
    }

    public Integer getChannel2ElectrifyTime() {
        return channel2ElectrifyTime;
    }

    public void setChannel2ElectrifyTime(Integer channel2ElectrifyTime) {
        this.channel2ElectrifyTime = channel2ElectrifyTime;
    }

    public Integer getOperatingHours() {
        return operatingHours;
    }

    public void setOperatingHours(Integer operatingHours) {
        this.operatingHours = operatingHours;
    }

    @Override
    public String toString() {
        return "GetSwitchOperatingHours{" +
                "deviceId=" + deviceId +
                ", channel1ElectrifyTime=" + channel1ElectrifyTime +
                ", channel2ElectrifyTime=" + channel2ElectrifyTime +
                ", operatingHours=" + operatingHours +
                '}';
    }
}
